<template>
  <div class="article-detail-page">
    <nav class="nav"> <span class="back" @click="$router.back()">&lt;</span> 面经详情</nav>
    <header class="header">
      <!-- @click="$router.back()">&lt添加点击退回方法 &lt是箭头符号  -->
      <!-- 从数据网络里找变量名称 -->
      <h1>{{ articles.stem }}</h1>
      <p>{{ articles.createdAt }} | {{  articles.views }} 浏览量 |  {{ articles.likeCount}} 点赞数</p>
      <p>
        <img src="http://teachoss.itheima.net/heimaQuestionMiniapp/%E5%AE%98%E6%96%B9%E9%BB%98%E8%AE%A4%E5%A4%B4%E5%83%8F%402x.png" alt=""> 
        <span>{{ articles.creatorName }}</span>
      </p>
    </header>
    <main class="body">
     {{ articles.content }}
    </main>
  </div>
</template>

<script>
export default {
  data(){
   return {
    articles:{}
   }
  },
  name: 'ArticleDetailPage',
  async created(){
    console.log(this.$route.params.id);
    const id = this.$route.params.id
    const {data} = await this.$axios.get(`https://mock.boxuegu.com/mock/3083/articles/${id}`)
    console.log(data);
    this.articles = data.result
  }
};
</script>

<style lang="less" scoped>
.article-detail-page {
  .nav {
    height: 44px;
    border-bottom: 1px solid #e4e4e4;
    line-height: 44px;
    text-align: center;
    .back {
      font-size: 18px;
      color: #666;
      position: absolute;
      left: 10px;
      top: 0;
      transform: scale(1, 1.5);
    }
  }
  .header {
     padding: 0 15px;
     p {
       color: #999;
       font-size: 12px;
       display: flex;
       align-items: center;
     }
     img {
       width: 40px;
       height: 40px;
       border-radius: 50%;
       overflow: hidden;
     }
  }
  .body {
     padding: 0 15px;
  }
}
</style>